﻿(function(){tinymce.create("tinymce.plugins.Orchard.MediaPicker",{init:function(b,d){b.addCommand("mceMediaPicker",function(){b.focus();var c,a=b.selection.getContent();if(a){a=a.replace(/\<IMG/gi,"<editimg");a=$(a).filter("editimg");if(a.length)c={src:a.attr("src"),"class":a.attr("class"),style:a.css("cssText"),alt:a.attr("alt"),width:a.attr("width"),height:a.attr("height"),align:a.attr("align")}}jQuery("#"+b.id).trigger("orchard-admin-pickimage-open",{img:c,uploadMediaPath:b.getParam("mediapicker_uploadpath"),
callback:function(e){b.focus();b.selection.setContent(e.img.html)}})});b.addButton("mediapicker",{title:b.getParam("mediapicker_title"),cmd:"mceMediaPicker",image:d+"/img/picture_add.png"})},createControl:function(){return null},getInfo:function(){return{longname:"Orchard MediaPicker Plugin",author:"Dave Reed",authorurl:"http://orchardproject.net",infourl:"http://orchardproject.net",version:"1.1"}}});tinymce.PluginManager.add("mediapicker",tinymce.plugins.Orchard.MediaPicker)})();